The present invention relates to methods and apparatuses for interfacing with logical device drivers of various types with a computer.
Computers are frequently called upon to work with a variety of devices. For example, when a multimedia presentation is made by a computer, the computer may be connected to multimedia output logical devices such as compact discs (either audio or video), a laser disc, an amplifier or a mixer. In addition to presenting data to output logical devices, the computer may be utilized to record and edit multimedia data obtained from a variety of input logical devices, such as the computer""s hard disk memory or MIDI (musical instrument digital interface) data.
The logical devices that the computer works with require different data structures and commands. A software system is used by a computer to interface with a logical device. It is desirable to utilize a single software system to work with all or most of the available logical devices. This simplifies the interfacing from a computer user""s point of view, as only one software system need be learned. In addition, a single software system for all of the logical devices provides flexibility and performance advantages over a software system for each logical device.
Of course, it is also desirable for such a software system to be commercially successful. One factor that determines whether a particular software system commercially succeeds is the base of applications and users for that software system. The faster and easier that applications can be written for a software system, and the easier that users (such as programmers) can learn the software system, then the more successful the system will be.
The acceptance of a software system by users is limited by its type of interface. In the prior art, two types of interfaces are a procedural interface and a string interface. A strictly procedural interface requires use of a language which the logical devices can understand. This type of xe2x80x9cmachinexe2x80x9d language is difficult for a human to understand. However, a procedural interface provides more options to a user because full use of a variety of logical devices is provided for.
A string interface on the other hand uses strings of words or text which is more easily understood by humans. Thus, a string interface provides ease of use in programming. However, a string interface provides limited options in that the full use of a variety of logical devices is not provided for.
The driver for each logical device could implement both a procedural and a string interface. As a practical matter, this is undesirable because such an implementation becomes prohibitively expensive in terms of subsystem development.
There is in the prior art a software system that merges the best of both string and procedural interfaces for multimedia devices. This software system is referred to as Multimedia Presentation Manager/2 for OS/2 (MMPM/2) and is commercially available from IBM (International Business Machines Corporation). The MMPM/2 software system utilizes a string language to provide command and data inputs. A command table of available commands is also provided. A user provides a command input string for a specified device. Parsing of the command table occurs with the command input string serving as the parsing source. Thus, each entry in the command input string is parsed against the various entries in the command table.
The use of string commands allows users to program using a string language that is common to all multimedia devices supported by the MMPM/2 software system. Users are shielded from the differences in the procedural data structures of the different devices.
The present invention provides improvements to the MMPM/2 software system by changing the parsing method. The improvements allow for efficient use of multiword string tokens in the command input strings and provide a more efficient parsing when no errors are found.
It is an object of the present invention to provide a method and apparatus that provides more efficient parsing of command input strings.
The method and apparatus of the present invention provide a command from a computer to a logical device that is connected to the computer. A command string containing the command is provided. A command structure for use with the command is built. The command structure has an information structure that can be utilized by the logical device. Information from the string is inserted into the information structure by parsing the command structure against the string.
In one aspect of the present invention, the command structure includes a data structure and one or more flags. The insertion of information from the string into the information structure includes the insertion of data from the string into the data structure. In another aspect of the present invention, the flags and data structure are passed from the computer to the logical device.
The information provided by the command string is converted into the command structure, so that the logical device can use the information. The command structure for a logical device typically includes flags and a data structure. The parser allocates the data structure which comprises number and size of data words that is required by the logical device. In addition, the data structure presents the data in the order that is expected by the logical device.
The present invention shields the user from the different data structures and flags that are required by different logical devices, so that the user need not be concerned with satisfying the peculiarities of a particular logical device. Instead, the user provides a command string that specifies the logical device, the desired command, and the necessary data. The present invention builds a linked list of tokens or keywords from the command string. Then, a command table for the specified logical device is found from memory. The command table contains plural commands for the specified logical device. Each command is capable of building the required data structure and providing the required flags to operate the specified logical device. Each command typically contains numerous keywords or tokens, such as wait, notify, etc. in order to satisfy all of the possible command strings. The command string is likely to contain only a few of the keywords in the command that is located in the command table. Thus, the command keywords are parsed, one at a time, against the command string, looking for matches. If no match between a command table keyword and a command string keyword is found, then the next command table keyword is parsed against the command string. If a match is found between the command table keyword and a command string keyword, the flag and data specified by the command table keyword and the matched command string keyword are inserted into the information structure that is to be passed to the logical device. The data for the data structure is obtained either from the command string or from the command table itself.
The present invention provides for more efficient parsing than in the prior art, especially when multiword string tokens are provided in the command string. A multiword token contained in the command table is more easily parsed against the command string than vice versa. This is especially true when keywords are used in multiple tokens. Parsing a multiword keyword contained in a command string against a command table leads to confusion and error, as specificity is difficult to accomplish against multiple occurrences of the same keyword in a command table.
Because the command table is used as the parsing source, great flexibility is achieved. The command table can be changed to provide a different look and feel to the data structure. Thus, if a new logical device is invented and connected to a computer, its required information structure can be easily accommodated by either editing the existing command tables, or creating a new command table. In addition, the overall parsing method can be changed by changing the command table. For example, in the specification that follows, the multimedia logical devices require 32 bit words. However, if a logical device requires 16 bit words, then the command table can be easily changed to accommodate this requirement.